<?php

namespace App\Http\Controllers\Web;

use App\Http\Controllers\Controller;
use App\Http\Resources\ServiceResource;
use App\Models\Video;
use Illuminate\Http\Request;

class VideoController extends Controller
{
    public function index(Request $request)
    {
        $per_page = $request->per_page ?? 12;

        $resources = Video::select(['id', 'title', 'link', 'published_at'])
            ->where('hide', 0)
            ->paginate($per_page);
        return new ServiceResource($resources);
    }

    public function show(Request $request, Video $video)
    {
        return $this->successful($video);
    }
}
